package com.ubxtech.sentinel.properties;

import com.alibaba.csp.sentinel.transport.config.TransportConfig;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.List;

/**
 *
 * @author Victor.Xiao
 * @since 2023-05-15 10:46
*/
@Data
@ConfigurationProperties(prefix = SentinelProperties.PREFIX)
public class SentinelProperties {
    public static final String PREFIX = "ubxtech.sentinel";

    /** 是否启用 true启用  */
    private String enabled;
    /**
     * 排除掉url校验
     */
    private List<String> excludePath;

    /**
     * 包含url校验,默认是/**
     */
    private List<String> includePath;


    /**
     * Transport configuration about dashboard and client.
     */
    private Transport transport = new Transport();


    public static class Transport {

        /**
         * Sentinel api port, default value is 8719 {@link TransportConfig#SERVER_PORT}.
         */
        private String port = "8719";

        /**
         * Sentinel dashboard address, won't try to connect dashboard when address is
         * empty {@link TransportConfig#CONSOLE_SERVER}.
         */
        private String dashboard = "";

        /**
         * Send heartbeat interval millisecond
         * {@link TransportConfig#HEARTBEAT_INTERVAL_MS}.
         */
        private String heartbeatIntervalMs;

        /**
         * Get heartbeat client local ip. If the client ip not configured, it will be the
         * address of local host.
         */
        private String clientIp;

        public String getHeartbeatIntervalMs() {
            return heartbeatIntervalMs;
        }

        public void setHeartbeatIntervalMs(String heartbeatIntervalMs) {
            this.heartbeatIntervalMs = heartbeatIntervalMs;
        }

        public String getPort() {
            return port;
        }

        public void setPort(String port) {
            this.port = port;
        }

        public String getDashboard() {
            return dashboard;
        }

        public void setDashboard(String dashboard) {
            this.dashboard = dashboard;
        }

        public String getClientIp() {
            return clientIp;
        }

        public void setClientIp(String clientIp) {
            this.clientIp = clientIp;
        }

    }
}
